﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PowerEx
{
    public partial class Dialog : Form
    {
        public string Value { get; set; }
        public TextBox TextDialog { get; set; }
        public Button B_Ok { get; set; }
        
        public Dialog()
        {
            InitializeComponent();
            TextDialog = textBox1;
            B_Ok = Ok;
        }

        private void Cancel_Click(object sender, EventArgs e)
        {
            Value = "";
            this.Close();
        }

        private void Ok_Click(object sender, EventArgs e)
        {
            Value = textBox1.Text;
            this.Close();
        }

        private void Dialog_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape) this.Close(); 
        }
        
    }
}
